<?php
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/module/lief/grid.css');
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/module/lief/normalize.min.css');
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/module/lief/styles.css');
if(Yii::app()->controller->action->id == 'profile'){
	Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/module/lief/ui-otherearth-style.css');
	Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/module/lief/fix_profile.css');
}
if(Yii::app()->controller->action->id == 'signup'){
	Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/module/lief/fix_signup.css');
}
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/module/lief/responsive.css');
Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/module/lief/extra-style.css');


Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/jquery.min.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/jquery-migrate-1.2.1.min.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/jquery.tools.min.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/jquery.wookmark.min.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/jquery.dd.js', CClientScript::POS_HEAD);

Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/jquery.simpleplaceholder.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/dropdowncontent.js', CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/imagesloaded.pkgd.min.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/jsinline.js');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/module/lief/intimedia.js');

$controller = Yii::app()->controller->getId();

$logo = $url = NULL;
$leftpane = '/img/leftpane/lief.jpg';

$siteId = isset($_GET['site']) ? $_GET['site'] : 0;

if ($siteId) {
	switch ($siteId){
		case 9 : $leftpane = '/img/leftpane/lief.jpg';
			break;
		case 3 : $leftpane = '/img/leftpane/passedon.jpg';
			break;
		case 4 : $leftpane = '/img/leftpane/otherearth.jpg';
			break;
		case 5 : $leftpane = '/img/leftpane/verawise.jpg';
			break;
		default: $leftpane = '/img/leftpane/lief.jpg';
		break;
	}
	$toolModel = new Tool();
	$tool = $toolModel->getTool($siteId);
	$logo = Yii::app()->params['liefDomain'] . '/uploads/tool/logo/' . $tool['logo'];
	$url = $tool['url'];
}
$url = Yii::app()->params['authDomain'];
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">

<title><?php echo CHtml::encode($this->pageTitle); ?></title>
<meta name="generator" content="SilverStripe - http:/silverstripe.org" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

<link rel="shortcut icon" href="/favicon.ico" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>

<!--[if lt IE 9]>
	<link type="text/css" rel="stylesheet" href="css/module/lief/ie-fixes.css"/>
	<script type="text/javascript" src="js/module/lief/html5shiv.js"></script>
	<![endif]-->
<style>
.leftpane{
background: url("<?php echo $leftpane; ?>") no-repeat scroll 0 0 rgba(0, 0, 0, 0) !important;
background-size: cover !important;
}
</style>	
</head>
<body id="intimedia">
	<aside id="cover" class="cover-sleeve">
		<div class="wrapfix theme-default leftpane">
			<h1>
			
				<a href="<?php echo $url ? $url : Yii::app()->params['liefDomain'].'/lief' ?>"> <img
					src="<?php echo $logo ? $logo : '/img/module/lief/intimedia_Logo.png'; ?>" width="50"
					alt="Site name" /> </a>
			</h1>
			<?php $languageModel = new LanguageSite(); ?>
			<?php
				$member = Yii::app()->session['member'];
				if (!$member) {
					$auth = new Authentication();
					$authcookie = Yii::app()->request->cookies['auth'];
					if($authcookie){
						$memberid = $auth->authTokenDecrypt($authcookie);
						$memberid = explode('-',$memberid);
						$memberid = $memberid[0];
						
						$memberModel = new MemberService(); 
						$member = $memberModel->getMemberByID($memberid);
					}
				}
			?>
               <?php if (!$member){ ?>
               <div id="prompter">
					<h2><a href="<?php echo Yii::app()->urlManager->createUrl('/auth/member/signup/site/' . $siteId); ?>">
                        <?php echo Yii::t('Common', 'Join For Free')?></a></h2>
					<hr>
					<div class="asidejoin" style="text-indent: 30px;">
						<span class="logintext"><?php echo Yii::t('Common', 'Already have an account? {a}Log in now{/a}', array('{a}'=>'<a href="' . Yii::app()->urlManager->createUrl('auth/member/signin/site/' . $siteId) . '" style="margin-left: 0px;">', '{/a}'=>'</a>'))?></span>
						<select id='language' class='mydds hidden'>
                        <?php foreach ($languageModel->getLanguageFromDB(null) as $val){?>
                        <option value='<?php  echo $val['CountryCode'];?>' 
                                <?php if (Yii::app()->session['langCurrent'] == $val['CountryCode']){
                                          echo 'selected="selected"';
                                }
                                 ?>
                                data-imagecss='<?php echo $val['Css'];?>' 
                                data-image='<?php echo Yii::app()->request->baseUrl.$val['Flag'];?>'>
                                <?php echo $val['NameCountry']?>
                        </option>
                        <?php }?>
                       
                        </select>
					</div>
					<div style="clear:both;"></div>
				</div>
               <?php }else{?>
			<div id="prompter">
				<div class="more-instruction"><?php echo Yii::t("Message", "Taking care of your Inner Circle");?></div>
				<hr />
				<a href="/" class="aside-logout"><div></div> </a>
				<div class="aside-home">
					<a href="javascript:void();">
                     	<strong id="aside-nickname">
                     	 <?php  if (isset($member['Nickname']) && $member['Nickname'] !="") {
                                echo $member['Nickname'];
                             } else {
                            	echo $member['FirstName'];
                            }
                       	?></strong></a>
                        <select id='language' class='mydds hidden'>
                        <?php foreach ($languageModel->getLanguageFromDB(null) as $val){?>
                        <option value='<?php  echo $val['CountryCode'];?>' 
                                       <?php if (Yii::app()->session['langCurrent'] == $val['CountryCode']){
                                                  echo 'selected="selected"';
                                            }
                                       ?>
                                data-imagecss=' <?php echo $val['Css'];?>' 
                                data-image='<?php echo Yii::app()->request->baseUrl.$val['Flag'];?>'>
                                <?php echo $val['NameCountry']?>
                         </option>
                         <?php }?>
                   		</select>
				</div>

				<div style="clear: both;"></div>
				<?php }?>
			</div>
		</div>
	</aside>

	<?php 
	$classMainExtend = '';
	if (array_key_exists("classMainExtend", $this->classExtend)) {
    	$classMainExtend = $this->classExtend["classMainExtend"];
	}?>
	<div id="main" class="has-fixed-right <?php echo $classMainExtend; ?>">
		<div class="mainpage inimedia-journey">
		<div class="maincontent"><?php echo $content; ?></div>
			<div class="mainline"></div>

			<div id="more-box" class="clearfix">
				<div class="more-box-col">
					<h6>About us</h6>
					<ul>
						<li><a href="mailto:contact@passed-on.com" class="link"
							target="_blank"><?php echo Yii::t("Common", "Contact us");?></a>
						</li>
						<li><a href="<?php echo Yii::app()->params['liefDomain'] .'/lief/main/media_info'; ?>" rel="#media_kit"><?php echo Yii::t("Common", "Media info");?></a>
						</li>
						<li><a href="<?php echo Yii::app()->params['liefDomain'] . '/lief/main/our_videos'; ?>" rel="#media_kit"><?php echo Yii::t("Common", "Our videos");?></a>
						</li>
					</ul>
				</div>
				<div class="more-box-col">
					<h6>
						<nobr><?php echo Yii::t("Common", "Help");?></nobr>
					</h6>
					<ul>
						<li class="first" id="howdoes"><a href="<?php echo Yii::app()->params['liefDomain'] . '/lief/main'; ?>"><?php echo Yii::t("Common", "How Lief works?");?></a>
						</li>

						<li><a href="<?php echo Yii::app()->params['liefDomain'] . '/lief/main/faq'; ?>" class="link">FAQ</a>
						</li>

					</ul>
				</div>
				<div class="more-box-col more-box-col-last">
					<h6>
						<nobr><?php echo Yii::t("Common", "Legal information");?></nobr>
					</h6>
					<ul>
						<li><a href="<?php echo Yii::app()->params['liefDomain'] . '/lief/main/terms_of_use'; ?>" class="link"> <nobr><?php echo Yii::t("Common", "Terms of use");?></nobr> </a>
						</li>
						<li><a href="<?php echo Yii::app()->params['liefDomain'] . '/lief/main/privacy'; ?>" class="link"> <nobr><?php echo Yii::t("Common", "Privacy");?></nobr> </a>
						</li>

					</ul>
				</div>
			</div>
		</div>
	</div>
	<!-- Popup comform when member click button logout   -->
<div id="confirmation-btn-logout" class="confirmation-popup-wrap">
	<div class="popupheader">
		<h6>
			<?php echo Yii::t("Common", "Notification");?>
		</h6>
	</div>
	<div class="contentWrap">
		<div class="text-center">
			<p id="description-Error">
				<?php echo Yii::t("Common", "Do you really want to logout?");?>
			</p>
		</div>
		<div class="buttons-box text-center">
			<input id="btnLogOutComformYes" type="button" class="btn disabled"
				value="<?php echo Yii::t('Message', 'Yes'); ?>"> <input
				id="btnLogOutComformNo" type="button" class="btn disabled"
				value="<?php echo Yii::t('Message', 'Cancel'); ?>">
		</div>
	</div>
</div>

</body>
</html>
